from time import sleep
from unittest import TestCase

from selenium import webdriver
from selenium.webdriver.common.by import By

from ecshop.po.EcshopPage import BaiduHomePage
from ecshop.utils.Config import Config


class TestBaidu(TestCase):
    file = './config/config.ini'  # 文件路径为自己的包路径
    config = Config(file)

    def test_ecshop(self):
        driver = webdriver.Chrome(self.config.get_value(self.file, 'system', 'driver'))
        ecshop = BaiduHomePage(driver)
        ecshop.open(self.config.get_value(self.file, 'system', 'url'))
        # baidu.input_search_text()
        # baidu.click_search_button()
        ecshop.input_usename_text()
        ecshop.input_password()
        ecshop.click_search_button()

        sleep(2)
        ecshop.into_frame_goods()
        sleep(2)
        ecshop.click_goods()



        sleep(2)


# class TestBaidu(TestCase):
#
#     def test_baidu_home(self):
#         driver = webdriver.Chrome()
#         baidu = BaiduHomePage(driver)
#         baidu.open('http://www.baidu.com')
#         baidu.input_search_text()
#         baidu.click_search_button()
#         sleep(5)